<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>class 和 promise 的使用</h1>

    <script>
      class User {
        constructor(name) {
          this.name = name
        }
        then(resolve, reject) {
          console.log('name_', this.name)
          // 这块说明了 then 返回的是个promise 虽然
          // resolve()
        }
      }

      async function Fun() {
        let user2 = new User('狗蛋')
        // console.log('狗蛋输出', user2.then())
        let user1 = await new User('张三')
        console.log(new User('张三'))
        // console.log('输出_user1', user1)
        console.log('李四 输出')
      }
      Fun()
      // console.log('user1', user1)
      // user1.then()
      // console.log('user1Fun', user1.then())
    </script>
  </body>
</html>
